

import { getWechatId } from "@/api/index"

// 定义一个 JavaScript 类
export default class ClientLogic {
    constructor() {
    }

    setCallback(callback) {
        this.callback = callback;
    }
    /**
     * 
     * @param {用户名字} userAlias 
     * @param {登录token} token 
     */
    async getClientInfo(wxId,alias,token,type) { 
        getWechatId({
            remarkName: alias,//alias
            wechatId: wxId,
            requestTime: new Date().getTime(),
        }, token).then(res => {
            console.log("用户信息", res)
            if(this.callback){
              if(res.success){
                  this.callback.onClientSuccess(res.data,alias,type);
              }else{
                  this.callback.onClientError(res.errorMsg);
              }
            }
          }).catch(err => {
            if(this.callback){
              this.callback.onClientError(err);
            }
          })
    }

}